package io.renren.modules.subject.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.subject.entity.CriminalStrikePersons;
import io.renren.modules.subject.service.CriminalStrikePersonsService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 案件信息表
 *
 * @author linyuan
 * @email linyuan@gmail.com
 * @date 2023-08-18 12:05:51
 */
@RestController
@RequestMapping("subject/criminalstrikepersons")
public class CriminalStrikePersonsController {
    @Autowired
    private CriminalStrikePersonsService criminalStrikePersonsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("subject:criminalstrikepersons:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = criminalStrikePersonsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("subject:criminalstrikepersons:info")
    public R info(@PathVariable("id") Integer id){
		CriminalStrikePersons criminalStrikePersons = criminalStrikePersonsService.getById(id);

        return R.ok().put("criminalStrikePersons", criminalStrikePersons);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("subject:criminalstrikepersons:save")
    public R save(@RequestBody CriminalStrikePersons criminalStrikePersons){
		criminalStrikePersonsService.save(criminalStrikePersons);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("subject:criminalstrikepersons:update")
    public R update(@RequestBody CriminalStrikePersons criminalStrikePersons){
		criminalStrikePersonsService.updateById(criminalStrikePersons);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("subject:criminalstrikepersons:delete")
    public R delete(@RequestBody Integer[] ids){
		criminalStrikePersonsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
